#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"

trigger-scheduler-docker-local-scheduler-tags-destroy() {
  declare desc="scheduler-docker-local scheduler-tags-destroy plugin trigger"
  declare trigger="scheduler-tags-destroy"
  declare DOKKU_SCHEDULER="$1" APP="$2" IMAGE_REPO="$3" IMAGE_TAG="$4"

  if [[ "$DOKKU_SCHEDULER" != "docker-local" ]]; then
    return
  fi

  "$DOCKER_BIN" image rm "$IMAGE_REPO:$IMAGE_TAG"
}

trigger-scheduler-docker-local-scheduler-tags-destroy "$@"
